//
//  HNSH_XFBCell.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2024/2/22.
//

#import "HNSH_XFBCell.h"

@interface HNSH_XFBCell ()

/* bgImgV */
@property (nonatomic, strong) UIImageView *bgImgV;

/* xfbBgView */
@property (nonatomic, strong) UIView *xfbBgView;
/* xfbIconImgV */
@property (nonatomic, strong) UIImageView *xfbIconImgV;
/* xfbLabel */
@property (nonatomic, strong) UILabel *xfbLabel;

/* jlIconImgV */
@property (nonatomic, strong) UIImageView *jlIconImgV;
/* 总奖励 */
@property (nonatomic, strong) UILabel *jlTitleLabel;

/* 所需慧果： */
@property (nonatomic, strong) UILabel *jlSxhgLabel;
/* 任务周期： */
@property (nonatomic, strong) UILabel *jlRwzqLabel;
/* 活跃度：   */
@property (nonatomic, strong) UILabel *jlHydLabel;

/* buttonDesLabel */
@property (nonatomic, strong) UILabel *buttonDesLabel;
/* button */
@property (nonatomic, strong) UIButton *button;

@end

@implementation HNSH_XFBCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor appBGColor];
        [self configView];
    }
    return self;
}

- (void)configView {
    [self.contentView addSubview:self.bgImgV];
    
    [self.bgImgV addSubview:self.xfbBgView];
    [self.xfbBgView addSubview:self.xfbIconImgV];
    [self.xfbBgView addSubview:self.xfbLabel];
    
    [self.bgImgV addSubview:self.jlIconImgV];
    [self.bgImgV addSubview:self.jlTitleLabel];
    [self.bgImgV addSubview:self.jlSxhgLabel];
    [self.bgImgV addSubview:self.jlRwzqLabel];
    [self.bgImgV addSubview:self.jlHydLabel];
    
    [self.bgImgV addSubview:self.buttonDesLabel];
    [self.bgImgV addSubview:self.button];
}

#pragma mark lazy
- (UIImageView *)bgImgV {
    if (!_bgImgV) {
        _bgImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xfb_cell_bg_0"]];
        _bgImgV.frame = CGRectMake(5, 0, kScreenWidth-10, 208);
    }
    return _bgImgV;
}

- (UIView *)xfbBgView {
    if (!_xfbBgView) {
        _xfbBgView = [[UIView alloc]initWithFrame:CGRectMake(5, 19, 170, 34)];
        _xfbBgView.backgroundColor = [UIColor appWhiteLabelColor];
        [self clipCornerWithView:_xfbBgView cornerWidth:17 cornerType:UIRectCornerTopRight|UIRectCornerBottomRight];
    }
    return _xfbBgView;
}
- (UIImageView *)xfbIconImgV {
    if (!_xfbIconImgV) {
        _xfbIconImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xfb_top_icon"]];
        _xfbIconImgV.frame = CGRectMake(12, 7, 20, 20);
    }
    return _xfbIconImgV;
}
- (UILabel *)xfbLabel {
    if (!_xfbLabel) {
        _xfbLabel = [[UILabel alloc]initWithFrame:CGRectMake(38, 7, 130, 20)];
        _xfbLabel.textColor = [UIColor appBlackLabelColor];
        _xfbLabel.font = [UIFont boldSystemFontOfSize:14];
        _xfbLabel.text = @"新手消费包（2/8）";
    }
    return _xfbLabel;
}

- (UIImageView *)jlIconImgV {
    if (!_jlIconImgV) {
        _jlIconImgV = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"xfb_money_icon"]];
        _jlIconImgV.frame = CGRectMake(23, 67, 27, 30);
    }
    return _jlIconImgV;
}
- (UILabel *)jlTitleLabel {
    if (!_jlTitleLabel) {
        _jlTitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(56, 69, 150, 26)];
        _jlTitleLabel.textColor = [UIColor appBlackLabelColor];
        _jlTitleLabel.font = [UIFont boldSystemFontOfSize:14];
        _jlTitleLabel.text = @"总奖励  +12.0慧果";
    }
    return _jlTitleLabel;
}
- (UILabel *)jlSxhgLabel {
    if (!_jlSxhgLabel) {
        _jlSxhgLabel = [[UILabel alloc]initWithFrame:CGRectMake(27, 110, 150, 20)];
        _jlSxhgLabel.textColor = [UIColor appBlackLabelColor];
        _jlSxhgLabel.font = [UIFont systemFontOfSize:14];
        _jlSxhgLabel.text = @"所需慧果：10";
    }
    return _jlSxhgLabel;
}
- (UILabel *)jlRwzqLabel {
    if (!_jlRwzqLabel) {
        _jlRwzqLabel = [[UILabel alloc]initWithFrame:CGRectMake(27, 138, 130, 20)];
        _jlRwzqLabel.textColor = [UIColor appBlackLabelColor];
        _jlRwzqLabel.font = [UIFont systemFontOfSize:14];
        _jlRwzqLabel.text = @"任务周期：45";
    }
    return _jlRwzqLabel;
}
- (UILabel *)jlHydLabel {
    if (!_jlHydLabel) {
        _jlHydLabel = [[UILabel alloc]initWithFrame:CGRectMake(27, 166, 130, 20)];
        _jlHydLabel.textColor = [UIColor appBlackLabelColor];
        _jlHydLabel.font = [UIFont systemFontOfSize:14];
        _jlHydLabel.text = @"活跃度：1";
    }
    return _jlHydLabel;
}

- (UILabel *)buttonDesLabel {
    if (!_buttonDesLabel) {
        _buttonDesLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth-10-200, 66, 175, 17)];
        _buttonDesLabel.textColor = [UIColor appBlackLabelColor];
        _buttonDesLabel.font = [UIFont boldSystemFontOfSize:12];
        _buttonDesLabel.text = @"观看激励视频";
        _buttonDesLabel.textAlignment = NSTextAlignmentRight;
    }
    return _buttonDesLabel;
}

- (UIButton *)button {
    if (!_button) {
        _button = [UIButton buttonWithType:UIButtonTypeCustom];
        _button.frame = CGRectMake(kScreenWidth-10-80-20, 90, 80, 32);
        [_button setTitle:@"兑换" forState:UIControlStateNormal];
        [_button setTitleColor:[UIColor colorWithHexString:@"#75869C"] forState:UIControlStateNormal];
        _button.titleLabel.font = [UIFont boldSystemFontOfSize:14];
        _button.backgroundColor = [UIColor appWhiteLabelColor];
        _button.layer.cornerRadius = 16.0f;
        _button.layer.masksToBounds = YES;
    }
    return _button;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
